// login_tip_dialog.dart (从你之前提供的代码复制)
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart'; // 需要导入这个

class KindTipsDialog extends StatelessWidget {
  final VoidCallback onDisagree;
  final VoidCallback onAgree;
  final VoidCallback onServiceAgreementTap;
  final VoidCallback onPrivacyPolicyTap;

  const KindTipsDialog({
    super.key,
    required this.onDisagree,
    required this.onAgree,
    required this.onServiceAgreementTap,
    required this.onPrivacyPolicyTap,
  });

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      backgroundColor: const Color(0xFF2C2C3A),
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
      contentPadding: const EdgeInsets.all(24.0),
      content: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          const Text(
            'Kind tips',
            style: TextStyle(
              color: Colors.white,
              fontSize: 18.0,
              fontWeight: FontWeight.bold,
            ),
            textAlign: TextAlign.center,
          ),
          const SizedBox(height: 16.0),
          RichText(
            textAlign: TextAlign.center,
            text: TextSpan(
              style: TextStyle(
                color: Colors.white.withOpacity(0.7),
                fontSize: 14.0,
                height: 1.5,
              ),
              children: [
                const TextSpan(
                  text:
                      'Before registering and logging in, you need to read and agree ',
                ),
                TextSpan(
                  text: 'Service Agreement',
                  style: const TextStyle(
                    color: Color(0xFF6B4EE8),
                    decoration: TextDecoration.underline,
                  ),
                  recognizer:
                      TapGestureRecognizer()..onTap = onServiceAgreementTap,
                ),
                const TextSpan(text: ' and '),
                TextSpan(
                  text: 'Privacy Policy',
                  style: const TextStyle(
                    color: Color(0xFF6B4EE8),
                    decoration: TextDecoration.underline,
                  ),
                  recognizer:
                      TapGestureRecognizer()..onTap = onPrivacyPolicyTap,
                ),
              ],
            ),
          ),
          const SizedBox(height: 24.0),
          Row(
            children: [
              Expanded(
                child: SizedBox(
                  height: 48.0,
                  child: ElevatedButton(
                    onPressed: onDisagree,
                    style: ElevatedButton.styleFrom(
                      backgroundColor: const Color(0xFF4A4A5A),
                      foregroundColor: Colors.white,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(24.0),
                      ),
                      elevation: 0,
                    ),
                    child: const Text(
                      'Disagree',
                      style: TextStyle(fontSize: 16.0),
                    ),
                  ),
                ),
              ),
              const SizedBox(width: 16.0),
              Expanded(
                child: Container(
                  height: 48.0,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(24.0),
                    gradient: const LinearGradient(
                      colors: [Color(0xFFAC6FFC), Color(0xFF6A40EE)],
                      begin: Alignment.centerLeft,
                      end: Alignment.centerRight,
                    ),
                  ),
                  child: ElevatedButton(
                    onPressed: onAgree,
                    style: ElevatedButton.styleFrom(
                      backgroundColor: Colors.transparent,
                      shadowColor: Colors.transparent,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(24.0),
                      ),
                      padding: EdgeInsets.zero,
                    ),
                    child: const Text(
                      'Agree',
                      style: TextStyle(color: Colors.white, fontSize: 16.0),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
